package ExerciseClass.Exercai1;

public class Exercise1 implements Exercise {
    public double swapNumber1(int n) {
        double sum = 0;
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= i; j++) {
                sum += j;
            }
        }
        return sum;
    }

    @Override
    public double swapNumber2(int n) {
        double sum = 0;
        for (int i = 1; i <= n; i++) {
            sum += i * (i + 1) / 2;
        }
        return sum;
    }

    @Override
    public double swapNumber3(int n) {
        double sum = n * (n + 1) * (n + 2) / 6;
        return sum;
    }
}
